//
//  BHAccount.m
//  xinlangweibo0621
//
//  Created by boldseas on 2017/6/24.
//  Copyright © 2017年 renbohan. All rights reserved.
//

#import "BHAccount.h"

@implementation BHAccount

+(instancetype)accountWithDict:(NSDictionary *)dict{
    BHAccount *account = [[BHAccount alloc]init];
    account.access_token = dict[@"access_token"];
    account.expires_in = dict[@"expires_in"];
    account.uid = dict[@"uid"];
    return account;
}

- (void)encodeWithCoder:(NSCoder *)enCoder{
    [enCoder encodeObject:self.access_token forKey:@"access_token"];
    [enCoder encodeObject:self.expires_in forKey:@"expires_in"];
    [enCoder encodeObject:self.uid forKey:@"uid"];
    [enCoder encodeObject:self.created_time forKey:@"created_time"];
    [enCoder encodeObject:self.name forKey:@"name"];
}

- (instancetype)initWithCoder:(NSCoder *)Decoder{
    if (self = [super init]) {
        self.access_token = [Decoder decodeObjectForKey:@"access_token"];
        self.expires_in = [Decoder decodeObjectForKey:@"expires_in"];
        self.uid = [Decoder decodeObjectForKey:@"uid"];
        self.created_time = [Decoder decodeObjectForKey:@"created_time"];
        self.name = [Decoder decodeObjectForKey:@"name"];
    }
    return self;
}

@end
